package com.example.demo.domain;


/* ━━━━━━佛祖保佑━━━━━━
 *                  ,;,,;
 *                ,;;'(    社
 *      __      ,;;' ' \   会
 *   /'  '\'~~'~' \ /'\.)  主
 * ,;(      )    /  |.     义
 *,;' \    /-.,,(   ) \    码
 *     ) /       ) / )|    农
 *     ||        ||  \)
 *     (_\       (_\
 * ━━━━━━永无BUG━━━━━━
 * @author ：zjq
 * @date ：2020/7/21 16:28
 * @description: TODO  返回码
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 */
public enum ResultCode implements IErrorCode {
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    NOT_FOUND(404,"服务未找到"),
    VALIDATE_FAILED(405, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    AUTHORIZATION_HEADER_IS_EMPTY(600, "请求头中的token为空"),
    GET_TOKEN_KEY_ERROR(601, "远程获取TokenKey异常"),
    GEN_PUBLIC_KEY_ERROR(602, "生成公钥异常"),
    JWT_TOKEN_EXPIRE(603, "token校验异常"),
    TOMANY_REQUEST_ERROR(429, "后端服务触发流控"),
    BACKGROUD_DEGRADE_ERROR(604, "后端服务触发降级"),

    BAD_GATEWAY(502, "网关服务异常"),
    GATEWAY_CONNECT_TIME_OUT(504,"网关超时"),
    FORBIDDEN(403, "没有相关权限");
    private long code;
    private String message;

    private ResultCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    public long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
